package com.dys;

import com.dys.dao.AccountDAO;
import com.dys.dao.impl.AccountDAOImpl;
import com.dys.entity.Account;

import java.math.BigDecimal;
import java.sql.SQLException;

/**
 * @className: com.dys.AccountDAOTest
 * @description: com.dys
 * @author: pine cone
 * @version: v1.0.0
 * @createTime: 2024/09/13 下午9:20
 */
public class AccountDAOTest {
    /**
     * 这是一个main()方法,是应用程序的入口
     *
     * @param args 方法的形参列表,是一个字符串数组,包含了从命令行传递给程序的参数
     */
    public static void main(String[] args) throws SQLException {
        // testFindAccountByCardNo();
        testUpdateAccountByCardNo();
    }

    /**
     * 测试查询
     *
     * @throws SQLException
     */
    public static void testFindAccountByCardNo() throws SQLException {
        AccountDAO accountDAO = new AccountDAOImpl();
        Account accountInfo = accountDAO.findAccountByCardNo("1001");
        System.out.println("账号信息：" + accountInfo);
    }

    /**
     * 测试修改
     *
     * @throws SQLException
     */
    public static void testUpdateAccountByCardNo() throws SQLException {
        AccountDAO accountDAO = new AccountDAOImpl();
        Account account = new Account();
        account.setCardNo("1001");
        account.setMoney(BigDecimal.valueOf(200.6));
        int count = accountDAO.updateAccountByCardNo(account);
        System.out.println("受影响行数：" + count);
    }
}
